package jeecg.business.entity.hot;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.core.util.wordseg.MmSegment;

import javax.persistence.SequenceGenerator;

import jodd.util.StringUtil;

/**   
 * @Title: Entity
 * @Description: 热点舆情
 * @author LinYingPiaoJian
 * @date 2015-10-10 10:59:12
 * @version V1.0   
 *
 */
@Entity
@Table(name = "NMS_HOT_KEYINFO", schema = "")
@SuppressWarnings("serial")
public class HotKeyinfoEntity implements java.io.Serializable {
	/**主键*/
	private java.lang.String id;
	/**企业ID*/
	private java.lang.String qyid;
	/**标题*/
	private java.lang.String title;
	/**内容*/
	private java.lang.String content;
	/**开始时间*/
	private java.util.Date starttime;
	/**结束时间*/
	private java.util.Date endtime;
	/**相关舆情*/
	private java.lang.String refids;
	/**负面值*/
	private java.lang.Float fmz;
	/**负面词*/
	private java.lang.String fmcjb;
	/**警戒词*/
	private java.lang.String fmc;
	/**警戒词次数*/
	private java.lang.String fmccs;
	/**关键字*/
	private java.lang.String keyword;
	/**相关词汇*/
	private java.lang.String refword;
	/**相关词汇次数*/
	private java.lang.String refwordnum;
	/**
	 * 出现次数
	 */
	private int appeartime;
	
	
	private String rltitle;
	
	private String ltitle;
	
	private String refwordtext;
	
	public static String PRE_RED = "<font color=\"red\">";
	public static String END_RED = "</font>";
	
	@Transient
	public String getScontent() {
		String scontent = null;
		
		if(StringUtil.isNotBlank(content)){
			int length = content.length();
			if(length>=300)
				scontent = content.substring((length-300)/2,300+(length-300)/2);
			else
				scontent = content;
		}
		return scontent;
	}
	
	@Transient
	public String getRefwordtext() {
		String t = "";
		if(StringUtil.isEmpty(refword)) return "";
		String [] refwords = refword.split("\\|");
		String [] nums = refwordnum.split("\\|");
		for(int i=0;i<refwords.length;i++)
			t += refwords[i]+"("+nums[i]+")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
		refwordtext = t;
		return refwordtext;
	}

	public void setRefwordtext(String refwordtext) {
		this.refwordtext = refwordtext;
	}
	
	@Transient
	public String getLtitle() {
		if(StringUtil.isNotBlank(title)){
			if(title.length()>=50)
				ltitle = title.substring(0,49);
			else
				ltitle = title;
		}
		return ltitle;
	}

	public void setLtitle(String ltitle) {
		this.ltitle = ltitle;
	}
	
	@Transient
	public String getRltitle() {
		ltitle = getLtitle();
		try {
			rltitle = ltitle;
			List<String> klist = MmSegment.segment(keyword);
			if(klist != null){
				for(String k : klist)
					rltitle = rltitle.replace(k, PRE_RED+k+END_RED);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return rltitle;
	}
	
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  主键
	 */
	
	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
	@Column(name ="ID",nullable=false,length=32)
	public java.lang.String getId(){
		return this.id;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  主键
	 */
	public void setId(java.lang.String id){
		this.id = id;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  企业ID
	 */
	@Column(name ="QYID",nullable=true,length=32)
	public java.lang.String getQyid(){
		return this.qyid;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  企业ID
	 */
	public void setQyid(java.lang.String qyid){
		this.qyid = qyid;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  标题
	 */
	@Column(name ="TITLE",nullable=true,length=511)
	public java.lang.String getTitle(){
		return this.title;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  标题
	 */
	public void setTitle(java.lang.String title){
		this.title = title;
	}
	/**
	 *方法: 取得java.lang.Object
	 *@return: java.lang.Object  内容
	 */
	@Column(name ="CONTENT",nullable=true,length=65535)
	public java.lang.String getContent(){
		return this.content;
	}

	/**
	 *方法: 设置java.lang.Object
	 *@param: java.lang.Object  内容
	 */
	public void setContent(java.lang.String content){
		this.content = content;
	}
	/**
	 *方法: 取得java.util.Date
	 *@return: java.util.Date  开始时间
	 */
	@Column(name ="STARTTIME",nullable=true)
	public java.util.Date getStarttime(){
		return this.starttime;
	}

	/**
	 *方法: 设置java.util.Date
	 *@param: java.util.Date  开始时间
	 */
	public void setStarttime(java.util.Date starttime){
		this.starttime = starttime;
	}
	/**
	 *方法: 取得java.util.Date
	 *@return: java.util.Date  结束时间
	 */
	@Column(name ="ENDTIME",nullable=true)
	public java.util.Date getEndtime(){
		return this.endtime;
	}

	/**
	 *方法: 设置java.util.Date
	 *@param: java.util.Date  结束时间
	 */
	public void setEndtime(java.util.Date endtime){
		this.endtime = endtime;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  相关舆情
	 */
	@Column(name ="REFIDS",nullable=true,length=511)
	public java.lang.String getRefids(){
		return this.refids;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  相关舆情
	 */
	public void setRefids(java.lang.String refids){
		this.refids = refids;
	}
	/**
	 *方法: 取得java.lang.Float
	 *@return: java.lang.Float  负面值
	 */
	@Column(name ="FMZ",nullable=true,precision=12)
	public java.lang.Float getFmz(){
		return this.fmz;
	}

	/**
	 *方法: 设置java.lang.Float
	 *@param: java.lang.Float  负面值
	 */
	public void setFmz(java.lang.Float fmz){
		this.fmz = fmz;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  负面词
	 */
	@Column(name ="FMCJB",nullable=true,length=32)
	public java.lang.String getFmcjb(){
		return this.fmcjb;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  负面词
	 */
	public void setFmcjb(java.lang.String fmcjb){
		this.fmcjb = fmcjb;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  警戒词
	 */
	@Column(name ="FMC",nullable=true,length=255)
	public java.lang.String getFmc(){
		return this.fmc;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  警戒词
	 */
	public void setFmc(java.lang.String fmc){
		this.fmc = fmc;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  警戒词次数
	 */
	@Column(name ="FMCCS",nullable=true,length=255)
	public java.lang.String getFmccs(){
		return this.fmccs;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  警戒词次数
	 */
	public void setFmccs(java.lang.String fmccs){
		this.fmccs = fmccs;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  关键字
	 */
	@Column(name ="KEYWORD",nullable=true,length=255)
	public java.lang.String getKeyword(){
		return this.keyword;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  关键字
	 */
	public void setKeyword(java.lang.String keyword){
		this.keyword = keyword;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  相关词汇
	 */
	@Column(name ="REFWORD",nullable=true,length=255)
	public java.lang.String getRefword(){
		return this.refword;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  相关词汇
	 */
	public void setRefword(java.lang.String refword){
		this.refword = refword;
	}
	/**
	 *方法: 取得java.lang.String
	 *@return: java.lang.String  相关词汇次数
	 */
	@Column(name ="REFWORDNUM",nullable=true,length=255)
	public java.lang.String getRefwordnum(){
		return this.refwordnum;
	}

	/**
	 *方法: 设置java.lang.String
	 *@param: java.lang.String  相关词汇次数
	 */
	public void setRefwordnum(java.lang.String refwordnum){
		this.refwordnum = refwordnum;
	}
	@Column(name ="APPEARTIME")
	public int getAppeartime() {
		return appeartime;
	}

	public void setAppeartime(int appeartime) {
		this.appeartime = appeartime;
	}
	
	
}
